local base = require 'ui_emu.base'
local control = require 'packages.chess-games.nchess.core.handler.ui_emu'
local Scene = base.Scene
local Piece = control.Piece

---@class NChess.RoomScene: Scene
local RoomScene = Scene:subclass("NChess.RoomScene")
RoomScene.scene_name = "Room"

---@param parent RequestHandler
function RoomScene:initialize(parent)
  Scene.initialize(self, parent)
  local room = parent.room --[[@as NChess.RoomBase]]
  local board = room.board

  for y, yArr in ipairs(board) do
    for x, id in ipairs(yArr) do
      if id ~= 0 then
        local item = Piece:new(self, id)
        item.xPos = x
        item.yPos = y
        self:addItem(item)
      end
    end
  end
end

return RoomScene

